package fourzerofour.yangqiang.day02;

import java.util.Arrays;

/**
 * 讲数组nums去掉重复数字后排序，得到结果为{0,1,2,3,4,5}
 */
public class Question3 {
    static final int[] nums = {1,3,0,1,2,2,5,4};

    public static void main(String[] args) {
        int[] n ={};
        for (int i=0;i<nums.length;i++){
            boolean bl = true;
            for(int j=0;j<n.length;j++){
                if(n[j]==nums[i]){
                    bl=false;
                    break;
                }
            }
            if(bl){
                n = Arrays.copyOf(n,n.length+1);
                n[n.length-1]=nums[i];
            }
        }
        int m;
        for(int i=0;i<n.length;i++){
            for(int j=0;j<n.length-i-1;j++){
                if(n[j]>n[j+1]){
                    m=n[j];
                    n[j]=n[j+1];
                    n[j+1]=m;
                }
            }
        }
        System.out.println(Arrays.toString(n));
    }
}
